import 'package:flutter/material.dart';

class Chapter7Page extends StatelessWidget {
  const Chapter7Page({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text("第七章"),
        leading: IconButton(
          icon: const Icon(Icons.home),
          onPressed: () => Navigator.of(context).pushNamed("/"),
        ),
      ),
      body: SingleChildScrollView(
        child: Center(
          child: Column(
            children: <Widget>[
              const SizedBox(height: 20),
              ElevatedButton(
                onPressed: () =>
                    Navigator.of(context).pushNamed("/chapter7/willpop/scope"),
                child: const Text("导航返回拦截（WillPopScope）"),
              ),
              const SizedBox(height: 20),
              ElevatedButton(
                onPressed: () => Navigator.of(context)
                    .pushNamed("/chapter7/inherited/widget"),
                child: const Text("数据共享（InheritedWidget）"),
              ),
              const SizedBox(height: 20),
              ElevatedButton(
                onPressed: () => Navigator.of(context)
                    .pushNamed("/chapter7/value/listenable"),
                child: const Text("Value Listenable Builder"),
              ),
              const SizedBox(height: 20),
              ElevatedButton(
                onPressed: () =>
                    Navigator.of(context).pushNamed("/chapter7/future/builder"),
                child: const Text("Future Builder"),
              ),
              const SizedBox(height: 20),
              ElevatedButton(
                onPressed: () =>
                    Navigator.of(context).pushNamed("/chapter7/stream/builder"),
                child: const Text("Stream Builder"),
              ),
              const SizedBox(height: 20),
              ElevatedButton(
                onPressed: () =>
                    Navigator.of(context).pushNamed("/chapter7/alert/dialog"),
                child: const Text("AlertDialog 对话框详解"),
              ),
            ],
          ),
        ),
      ),
    );
  }
}
